use "kriner_schickler_ch2_replication_allinvestigations.dta"

* Table 2.1 *
ttest misconductdays, by(dg)
ttest hmisconductdays, by(hdg)
ttest smisconductdays, by(sdg)

* Table 2.2 *
nbreg hmisconductdays hdg inflation pctdpcrealgdp war  preselyear congelyear , robust
outreg2 using ch2table2.2, word  label dec(2) onecol sortvar(hdg inflation pctdpcrealgdp unemp war preselyear congelyear) replace
nbreg hmisconductdays hdg inflation unemp pctdpcrealgdp war  preselyear congelyear if year > 1946, robust
outreg2 using ch2table2.2, word  label dec(2) onecol sortvar(hdg inflation pctdpcrealgdp unemp war preselyear congelyear) append
nbreg hmisconductdays hdg inflation unemp pctdpcrealgdp war  preselyear congelyear, robust
outreg2 using ch2table2.2, word  label dec(2) onecol sortvar(hdg inflation pctdpcrealgdp unemp war preselyear congelyear) append

* Table 2.3 *
ttest hmisconductdays if year < 1937, by(hdg)
ttest hmisconductdays if year > 1936 & year < 1981, by(hdg)
ttest hmisconductdays if year > 1980, by(hdg)

* Table 2.4 *
nbreg hmisconductdays hdg hdgxhpolar hpolar inflation pctdpcrealgdp war  preselyear congelyear, robust
outreg2 using ch2table2.4, word  label dec(2)   replace

* Table 2.5 *
nbreg smisconductdays sdg inflation pctdpcrealgdp war  preselyear congelyear , robust
outreg2 using ch2table2.5, word  label dec(2) onecol sortvar(sdg inflation pctdpcrealgdp unemp war preselyear congelyear) replace
nbreg smisconductdays sdg inflation unemp pctdpcrealgdp war  preselyear congelyear if year > 1946, robust
outreg2 using ch2table2.5, word  label dec(2) onecol sortvar(sdg inflation pctdpcrealgdp unemp war preselyear congelyear) append
nbreg smisconductdays sdg inflation unemp pctdpcrealgdp war  preselyear congelyear, robust
outreg2 using ch2table2.5, word  label dec(2) onecol sortvar(sdg inflation pctdpcrealgdp unemp war preselyear congelyear) append

* Table 2.6 *
ttest smisconductdays if year < 1937, by(sdg)
ttest smisconductdays if year > 1936 & year < 1981, by(sdg)
ttest smisconductdays if year > 1980, by(sdg)

* Appendix Table 2.1 *
arpois hmisconductdays hdg inflation pctdpcrealgdp war  preselyear congelyear , ar(1) robust
outreg2 using ch2apptable2.1, word  label dec(2)   replace
drop  _z _rho1 

* Appendix Table 2.2 *
arpois smisconductdays sdg inflation pctdpcrealgdp war  preselyear congelyear , ar(1) robust
outreg2 using ch2apptable2.2, word  label dec(2)   replace
drop  _z _rho1 

* Appendix Table 2.3 *
nbreg smisconductdays sdg sdgxspolar spolar inflation pctdpcrealgdp war  preselyear congelyear, robust
outreg2 using ch2apptable2.3, word  label dec(2)   replace

* Appendix Table 2.4 *
ttest oversightdays, by(dg)
ttest hoversightdays, by(hdg)
ttest soversightdays, by(sdg)
